<?php

namespace App\Http\Controllers;

use App\Library\Requests\Auction\AuctionOrderAddressRequest;
use App\Library\Requests\Auction\AuctionOrderPageRequest;
use App\Library\Requests\Base\BaseDeliveryRequest;
use App\Library\Requests\Base\SerialNumberRequest;
use App\Library\Service\AuctionOrderService;
use Exception;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Http\JsonResponse;

class AuctionOrderController extends BaseController
{
    /**
     * @param AuctionOrderService $service
     */
    public function __construct(AuctionOrderService $service)
    {
        $this->service = $service;
    }

    /**
     * 发货
     * @param BaseDeliveryRequest $request
     * @return JsonResponse
     *
     * @throws GuzzleException
     */
    public function delivery(BaseDeliveryRequest $request): JsonResponse
    {
        return $this->service->delivery($request);
    }

    /**
     * 物流信息查询
     * @param SerialNumberRequest $request
     * @return JsonResponse
     *
     */
    public function logistics(SerialNumberRequest $request): JsonResponse
    {
        return $this->service->logistics($request);
    }

    /**
     * 拍卖订单填写地址
     * @param AuctionOrderAddressRequest $request
     * @return JsonResponse
     */
    public function address(AuctionOrderAddressRequest $request): JsonResponse
    {
        return $this->service->address($request);
    }

    /**
     * 确认收货
     * @param SerialNumberRequest $request
     * @return JsonResponse
     *
     */
    public function confirmReceipt(SerialNumberRequest $request): JsonResponse
    {
        return $this->service->confirmReceipt($request);
    }

    /**
     * 退保证金
     * @param int $id
     * @return JsonResponse
     * @throws Exception
     */
    public function refundBail(int $id): JsonResponse
    {
        return $this->service->refundBail($id);
    }

    /**
     * 用户删除拍卖订单
     * @param SerialNumberRequest $request
     * @return JsonResponse
     *
     */
    public function userDelete(SerialNumberRequest $request): JsonResponse
    {
        return $this->service->userDelete($request);
    }

    /**
     * 商家删除拍卖订单
     * @param SerialNumberRequest $request
     * @return JsonResponse
     *
     */
    public function sellerDelete(SerialNumberRequest $request): JsonResponse
    {
        return $this->service->sellerDelete($request);
    }

    /**
     * 拍卖订单分页-用户
     * @param AuctionOrderPageRequest $request
     * @return JsonResponse
     *
     */
    public function userPaging(AuctionOrderPageRequest $request): JsonResponse
    {
        return $this->service->userPaging($request);
    }

    /**
     * 拍卖订单分页-商家
     * @param AuctionOrderPageRequest $request
     * @return JsonResponse
     *
     */
    public function sellerPaging(AuctionOrderPageRequest $request): JsonResponse
    {
        return $this->service->sellerPaging($request);
    }

    /**
     * detail
     * @param SerialNumberRequest $request
     * @return JsonResponse
     */
    public function detail(SerialNumberRequest $request): JsonResponse
    {
        return $this->service->detail($request);
    }
}
